Fix copy dictation instructions button on agentic-authoring page#24362
Fix copy dictation instructions button on agentic-authoring page#24362
Conversation
- Rename button label from 'Copy full instructions' to 'Copy dictation instructions' - Fix Playwright test URL from non-existent /tools/creating-workflows/ to /guides/agentic-authoring/ - Fix content assertion from 'Fix text-to-speech errors' to 'Fix Speech-to-Text Errors' - Fix route intercept patterns from **/*.instructions.md to **/SKILL.md - Remove stale debug screenshot/console.log from test Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b142f158-b904-4978-8a06-05b0d92eabc2 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes and re-validates the “Copy dictation instructions” button on /guides/agentic-authoring/#dictation by aligning Playwright coverage and docs labels with the actual page, content, and fetch target.
Changes:
- Update the Playwright test to navigate to the correct page and assert the correct dictation prompt content.
- Fix the route interception pattern so error-path tests actually intercept the SKILL.md fetch.
- Rename the dictation button label in relevant MDX pages for consistency.
Show a summary per file
| File | Description |
|---|---|
| docs/tests/copy-button.spec.ts | Updates URL, assertions, and route interception for the dictation copy button test coverage. |
| docs/src/content/docs/reference/custom-agent-for-aw.mdx | Renames the dictation copy button label to match the intended UI wording. |
| docs/src/content/docs/guides/agentic-authoring.mdx | Renames the dictation copy button label on the agentic-authoring guide. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
docs/tests/copy-button.spec.ts:68
- Same issue as above:
hasText: 'Copy dictation instructions'makes the locator dependent on the initial label, but the button text changes toErrorduring this test. After the click the locator may no longer resolve to the element, causing assertions liketoHaveText('Error')to fail. Prefer selecting by a stable attribute such asdata-filepath.
// Find the "Copy dictation instructions" button
const copyButton = page.locator('.copy-entire-file-btn', {
hasText: 'Copy dictation instructions',
});
docs/tests/copy-button.spec.ts:123
- Same issue as above in this test case: the locator’s
hasTextfilter can prevent it from matching once the button transitions toError, leading to flaky assertions. Use a stable selector (for example based ondata-filepath) and keep text assertions on.btn-textonly.
// Find the "Copy dictation instructions" button
const copyButton = page.locator('.copy-entire-file-btn', {
hasText: 'Copy dictation instructions',
});
- Files reviewed: 3/3 changed files
- Comments generated: 1
| // Find the "Copy dictation instructions" button | ||
| const copyButton = page.locator('.copy-entire-file-btn', { | ||
| hasText: 'Copy full instructions', | ||
| hasText: 'Copy dictation instructions', | ||
| }); |
There was a problem hiding this comment.
The locator is filtered by hasText: 'Copy dictation instructions', but the button text changes to Copying…/Copied!/Error after clicking. Because Playwright locators are re-evaluated on each action/assertion, this locator can stop matching the button after the click, making the subsequent expectations flaky or fail. Use a stable selector (e.g., match data-filepath for the dictation SKILL.md) and assert the initial .btn-text separately.
This issue also appears in the following locations of the same file:
- line 65
- line 120
See below for a potential fix:
// Find the dictation instructions copy button using a stable selector
const copyButton = page.locator(
'.copy-entire-file-btn[data-filepath*="dictation"][data-filepath$="SKILL.md"]'
);
// Ensure the button is visible
await expect(copyButton).toBeVisible();
await expect(copyButton.locator('.btn-text')).toHaveText(
'Copy dictation instructions'
);
The Playwright test for the dictation copy button was broken in multiple ways, meaning the button on
/guides/agentic-authoring/#dictationwas untested and unvalidated.Changes
/gh-aw/tools/creating-workflows/→/gh-aw/guides/agentic-authoring/(page doesn't exist; dictation button lives on agentic-authoring)Fix text-to-speech errors→Fix Speech-to-Text Errors(actual##heading inSKILL.md)**/*.instructions.md→**/SKILL.md— previous pattern never matched the actual fetch target, making both error-case tests no-ops"Copy full instructions"→"Copy dictation instructions"inagentic-authoring.mdxandcustom-agent-for-aw.mdx— consistent with"Copy debug instructions"/"Copy agentic-chat instructions"on the same page